/**
 * 定义请求响应的通用结构
  */
export interface ApiResponse<T = any> {
    code: number
    message: string
    data: T
}

/**
 * 分页查询列表数据结构
 */
export class PageData<T> {
    records: T[]
    total: number
    size: number
    current: number;
    constructor(init?: Partial<PageData<T>>) {
        if (init) {
            Object.assign(this, init);
        }
    }
}

/**
 * 分页查询基础参数
 */
export class PageQuery {
    public size: number = 10;
    public current: number = 1;
    constructor(init?: Partial<PageQuery>) {
        if (init) {
            Object.assign(this, init);
        }
    }
}

/**
 * 数据详情基础结构
 */
export class BaseDetail{
    id: number = null;
    createName: string = null;
    createTime: string = null;
    updateName: string = null;
    updateTime: string = null;
    constructor(init?: Partial<BaseDetail>) {
        if (init) {
            Object.assign(this, init);
        }
    }
}

/**
 * 树结构
 */
export class TreeOption{
    id: number = null;
    label: string = null;
    parentId: number = null;
    value: number = null;
    constructor(init?: Partial<TreeOption>) {
        if (init) {
            Object.assign(this, init);
        }
    }
}

/**
 * 下拉选项
 */
export class SelectOption {
    value: string = null;
    label: string = null;
    constructor(init?: Partial<SelectOption>) {
        if (init) {
            Object.assign(this, init);
        }
    }
}